import requests

url = " http://127.0.0.1:5000/login"
data = {'username':"wwj",'pwd':"123456"}

res1 = requests.post(url,json=data)
print(res1.cookies)

#1. 获取登录返回的cookies
cookies = res1.cookies


#2.添加登录返回的cookies,访问首页成功
res2 = requests.post("http://127.0.0.1:5000",json= data,cookies= cookies)

print(res2.status_code)
print(res2.headers)
print(res2.text)